home *** CD-ROM | disk | FTP | other *** search
/ Games of Daze / Infomagic - Games of Daze (Summer 1995) (Disc 1 of 2).iso / x2ftp / msdos / source / snip9503 / which_c.txt < prev    next >
Text File  |  1995-03-14  |  16KB  |  303 lines

  1. Q:  Which PC C/C++ compiler is best and what should I buy?
  2.  
  3. A:  This is perhaps the commonest of Frequently Asked Questions (FAQ's),
  4. especially by beginning C'er. The honest answer is that there is no "best"
  5. compiler and what may be best for you depends to a large degree on what
  6. you'll be using it for. The PC C/C++ compiler market is quite brutal and the
  7. companies that have survived have done so because some number of people think
  8. each of them makes the "best" compiler.
  9.  
  10.     With the preceding caveat in mind, following are some summaries of the
  11. current crop of C/C++ compilers with some of their strengths and weaknesses.
  12. Additional recommended reading are the C/C++ compiler reviews appearing in PC
  13. Magazine. PC Mag's reviews for many years were highly slanted and suspect,
  14. but, in recent years, have become commendably objective and even-handed.
  15.  
  16.  
  17. MIX POWER C
  18. -----------
  19.  
  20. Power C is the least expensive PC C compiler on the market. The compiler
  21. itself is $20, and an additional $30 will buy their source-level debugger
  22. along with the complete library source code with an assembler.
  23.  
  24. So, what's the catch?
  25.  
  26. None, actually. Power C is a quite decent and ANSI-conforming compiler which
  27. compiles relatively tight, fast code relatively quickly. It's biggest
  28. drawback is its use of a non-standard object file format which obviates
  29. object-level compatibility with any other compiler using Microsoft/Intel
  30. standard object file formats. Another problem is lack of support from 3rd
  31. party library vendors. Although Mix sells a wide range of libraries
  32. themselves, it's difficult to convince a vendor to produce a $100 add-on
  33. library for a $20 compiler.
  34.  
  35. On the plus side, Power C comes with the best user's manual for students in
  36. the business. The beginner's tutorial section has enabled many beginning C
  37. programmers to get up to speed without spending another dime on any other
  38. textbooks. Should you want more instruction, Mix sells a package including
  39. Power C with the library source and debugger along with the book "Master C"
  40. for only $60.
  41.  
  42. Power C's primary technical claim to fame is its floating point which
  43. challenges the industry leader, Watcom, in many cases. It's also the only
  44. remaining C compiler which can run effectively on small or older machines
  45. without extended memory (SC++ can also, but is limited to *very* small
  46. programs).
  47.  
  48.  
  49.  
  50. MICROSOFT VISUAL C++ (VC++)
  51. ---------------------------
  52.  
  53. Microsoft's professional compiler now comes in two versions with the same
  54. name. The profession version replaces Microsoft C/C++, version 7.0. The
  55. regular version replaces Microsoft Quick C for Windows. The primary
  56. difference is the price and the extras since each requires at least a 386
  57. processor, 4 Mb of *available* extended memory, and a DPMI server such as
  58. Windows 3.1. If you don't have the machine resources, you can't use VC++.
  59.  
  60. On the plus side, VC++ is an excellent C++ compiler and generates executables
  61. which may not always be smaller than Borland, but usually execute faster.
  62. Microsoft's C compilers are still the standard for PC C compilers and it
  63. shows in the ready availability of 3rd party libraries supporting it. Support
  64. for Windows programming is excellent with tools only rivaled by SC++ (which is
  65. shipped with licensed copies of VC++'s MFC 2.0 class library).
  66.  
  67. Compile times with full optimization are still quite sluggish, but using the
  68. quick compile option can be provide acceptable results.
  69.  
  70.  
  71. BORLAND C++ (BC++)
  72. ------------------
  73.  
  74. BC++ carries on Borland's tradition of providing excellent bang for the buck.
  75. The latest release (3.1) of their professional compiler is an attractive
  76. alternative to shops also considering VC++. BC++ isn't as demanding as VC++
  77. and only requires a 286 and 2 Mb of *available* extended memory to run. A full
  78. 32-bit version is currently available for OS/2 2.1. Windows programming
  79. support is also quite good, but has been leapfrogged somewhat by VC++ and SC++
  80. for the time being.
  81.  
  82. Borland's tools are uniformly excellent, but the compiler still suffers a bit
  83. in comparison to the industry's technological leaders, Microsoft, Watcom, and
  84. Symantec - although the gap is closing. As with VC++, it's an excellent C++
  85. compiler and enjoys widespread support among 3rd party library vendors. Like
  86. all Borland compilers, ease of use was a design priority, all oriented to the
  87. excellent IDE.
  88.  
  89. Borland recently alienated many of their loyal customers with the release of
  90. BC++ 4.0. In addition to the normal version x.0 bugs that we all expect, the
  91. new version came with no DOS IDE, vastly slower compilation times (with no
  92. apparent increase in optimization to justify the slowdown), and an odious new
  93. license agreement that their lawyers quickly rescinded in the face of the
  94. massive desertion of corporate clients. They're working hard to get folks to
  95. like them again, but for the first time in their corporate life, they have
  96. seriously dissatisfied customers and aren't quite sure how to handle it.
  97.  
  98.  
  99. TURBO C++ (TC++)
  100. ----------------
  101.  
  102. TC++ is to Borland's C++ compiler targeted at the hobbyist market. The latest
  103. version (TC++ 3.1) raised quite a stir when Borland released it requiring at
  104. least a 286 processor and 1 Mb of *available* extended memory above the
  105. normal 640K DOS limit.  Many hobbyists running on older XT's, or machines
  106. without the excess memory capacity have therefore failed to upgrade to the
  107. new release.
  108.  
  109. If you have the machine to support it, TC++ has the usual Borland attributes
  110. of extreme ease-of-use, attractive Integrated Development Environment (IDE),
  111. and good supporting tools. Based on the facts of BC++ 4.0 cited above, it has
  112. become the compiler of choice for many Borland loyalists.
  113.  
  114.  
  115. SYMANTEC C++ (SC++)
  116. -------------------
  117.  
  118. Symantec C++ (nee Zortech C++) was the industry's first C++ compiler, but fell
  119. behind in tracking the C++ language spec. Bought out by Symantec in 1991, the
  120. C compiler was always excellent and now its C++ compiler rates among the best.
  121.  
  122. SC++ supports DOS, Mac, Unix, Win32s, and NT (OS/2 was supported in previous
  123. Zortech releases and may be again) using an extremely powerful new object-
  124. oriented Windows-hosted IDE. It includes excellent libraries and add-ons
  125. including a TSR library, swapping spawn functions, a royalty-free 32-bit DOS
  126. extender, and an excellent set of ancillary C and C++ tools libraries
  127. including MFC 2.0 as previously noted. SC++ can generate true 32-bit code and
  128. has a switch for generating Pentium code. At the same time that Symantec
  129. bought Zortech, they also bought Multiscope, whose debuggers are included in
  130. the package. As with VC++, SC++ includes excellent tools for quickly
  131. developing Windows applications.
  132.  
  133. SC++ has always been in the forefront of optimizer technology along with
  134. Microsoft and Watcom. A major feature is full IEEE-754 and NCEG (Numerical C
  135. Extensions Group (an ANSI working committee trying to make C a suitable
  136. replacement for FORTRAN) compatibilty.
  137.  
  138. The only negative for the current release is a poor reputation which arose
  139. largely during the period following the Symantec acquisition of Zortech. With
  140. 6.1, the bugs now appear mostly fixed. With the 6.1 release, support of DOS
  141. graphics has been dropped, but an updated version of the excellent Flash
  142. Graphics package shipped with the Zortech versions is available from FlashTek,
  143. which also supplies improved verions of the 32-bit DOS extender and the
  144. pre-Symantec debugger.
  145.  
  146. One caveat - if you got the 6.0 release, be sure to get the free 6.1 update!
  147.  
  148.  
  149. WATCOM C/C++ (WC++)
  150. -------------------
  151.  
  152. Watcom has traditionally been the technological industry leader, performing
  153. feats of optimization and floating point speed other vendors only dreamt of.
  154. The cost has been compile speed, which has been described (somewhat unfairly)
  155. as glacial. For all its technical excellence, WC++ is still a niche market
  156. compiler like SC++. As such, it's 3rd party support is poor, but many have
  157. found that Microsoft C libraries can be made to work with WC++, often with
  158. nothing more than recompilation. As other compilers (most notably VC++ and
  159. SC++) have advanced, WC++'s technological lead has diminished and even been
  160. reversed for some applications. Like SC++, and unlike BC++ and VC++, WC++
  161. provides documented support for embedded systems work, although not to nearly
  162. the same degree as Metaware (see below).
  163.  
  164. Also, like SC++, WC++ supports 32-bit code generation. WC++ is the compiler
  165. of choice for many OEMs, such as Novell, who want only the best supporting
  166. code for their products. MSC/VC++ compatibility is excellent, but watch out
  167. for Watcom's sensitivity to proper _cdecl declarations, implemented in Watcom
  168. via a pragma rather than as a built-in language feature. Watcom sells both
  169. 16- and 32-bit versions of its C/C++ compiler. The best deal is to buy the
  170. 32-bit compiler and then purchase the 16-bit upgrade pack.
  171.  
  172. Where Watcom really shines is its support for a multitude of environments
  173. with the same compiler(s). Supported are DOS, Win3.1, Win32s, NT, OS/2 (1.x &
  174. 2.x), Netware 386, AutoCAD ADS, QNX, Phar Lap and Rational DOS extenders.
  175. With such a bewildering array of targets, compilation is relatively
  176. straightforward but the linker has a steep learning curve.
  177.  
  178. Watcom remains the only one of the "big name" compilers to not ofer an IDE,
  179. if that's important to you or you don't own a "real" programmer's editor.
  180.  
  181.  
  182. METAWARE HIGH-C/C++ (HC++)
  183. --------------------------
  184.  
  185. HC++ is the darling of some segments of the embedded systems market. As such,
  186. it's a lot like WC++, only not quite as good and a lot weirder since it
  187. offers detailed control over every aspect of the executable. Most WC++
  188. comments apply, except for the ones relating to quality of generated code.
  189. HC++'s code is quite good, but seems to be showing its niche market
  190. orientation (any one remember Manx Aztec C?)
  191.  
  192.  
  193. TOPSPEED C/C++ (TSC++)
  194. ----------------------
  195.  
  196. TSC++ has had a rocky life, getting off to a late start in the market and
  197. never having really quite caught on. Originally, TSC++ was a Turbo C clone
  198. which shared tools and environments with its sister Modula-2 compiler. More
  199. recent versions have extended this by using a modular approach with an
  200. environment supporting "plug-in" compilers for various languages which can
  201. all be used together. The company was recently acquired by Clarion.
  202.  
  203. TSC++'s undisputed biggest strength is its smart linker and various features
  204. added to facilitate mixed-language programming (Modula-2, for example,
  205. supports multi-threaded code). Using this technology, you can count on TSC++
  206. to almost always produce the smallest executables for a given piece of source
  207. code. The library, written almost exclusively in assembly, is also excellent
  208. and contributes to the frugal use of run-time memory. Unfortunately, the code
  209. generated by the compiler - even with full optimization - is typically not
  210. of the same quality as the library modules.
  211.  
  212. Drawbacks include almost non-existant 3rd party support and the pervasive IDE
  213. which feels more at home to Modula-2 programmers than C programmers.
  214.  
  215.  
  216. GNU C/C++ (GCC, G++)
  217. --------------------
  218.  
  219. Available from the Free Software Foundation (FSF), GCC and G++ are two of
  220. only three compilers listed here available for free (the other is Micro-C).
  221. Originally written for Unix systems, there are several DOS and OS/2 ports
  222. available. All of the DOS ports require some sort of DOS extender technology
  223. built-in in order to work in DOS's limited memory.  OS/2 ports obviously
  224. don't share this limitation. The EMX port for OS/2 is among the best and is
  225. quite popular among OS/2 programmers. Along with SC++, WC++, and HC++, the
  226. gnu compilers round out the list of full ISO/ANSI/ARM compilers with explicit
  227. support for embedded systems.
  228.  
  229. Performance is decent, but not earth-shattering, and executables - especially
  230. small utilities - tend to exhibit some bloat. This may be overcome by using
  231. some non-standard compiler features unique to FSF compilers at the expense of
  232. portability.
  233.  
  234. All GNU software carries the FSF's "GNU General Public License". This is
  235. their infamous "copyleft" license that guarantees their software tools remain
  236. free, yet imposes restrictions on redistribution and commercial distribution
  237. of the GNU tools and software developed with them. If you plan to use one of
  238. these to write commercial code, be sure and read the license agreement *very*
  239. closely.
  240.  
  241.  
  242. DUNFIELD MICRO-C
  243. ----------------
  244.  
  245. There have been many "small" or "tiny" C's over the years, some useful for
  246. teaching the rudiments of compiler construction, others not much use for
  247. anything. Small C's typically lack structs, unions, bit fields, and even long
  248. integers.
  249.  
  250. Why bother listing this one then?
  251.  
  252. First of all, Micro-C is an evolving product which, as of version 3, now
  253. includes many features such as structs and unions not normally associated
  254. with small C's.
  255.  
  256. Secondly, Dave Dunfield recently made the DOS version of Micro-C freeware.
  257. You can use it without restriction or licensing fees to create DOS programs.
  258.  
  259. Third, the source code (available when you register the shareware version) is
  260. quite decent and really can teach you something about compiler internals. But
  261. Micro-C is genuinely useful for a lot more reasons.
  262.  
  263. Finally, the PC library includes support for writing TSR's, interrupt-driven
  264. serial I/O, and screen windowing. Amazingly, it also sports an optimizer, but
  265. requires MASM or equivalent for compiling PC applications.
  266.  
  267. How does Dave provide such a nifty tool for free? Simple - he makes his money
  268. off of Micro-C by producing cross-assemblers for a variety of microprocessors
  269. and provides plug-in code generators for his C compiler to use with those
  270. chips as well. The 80x86 version comes ready to compile either PC or embedded
  271. code.
  272.  
  273. Supporting small and tiny model only, Micro-C executables are phenomenally
  274. small. "Hello world" programs that run 5-6K on other compilers run under 600
  275. bytes when compiled with Micro-C.
  276.  
  277. One other point needs to be mentioned with respect to Micro-C...  Although it
  278. is *a* small C, it has no code commonality with *the* Small C from the book
  279. of the same name. This is important since there are a number of variants of
  280. Small C available, all not much better than the original.  Micro-C, OTOH, was
  281. written by Dave Dunfield completely from scratch and is a *much* better
  282. designed piece of code and certainly much more instructive to fledgling
  283. compiler writers. His better design is evinced in code quality and execution
  284. speed.
  285.  
  286.  
  287. PCC
  288. ---
  289.  
  290. The Personal C Compiler is available as shareware. It used to be marketed as
  291. the deSmet C compiler and had a generally good reputation for quick compile
  292. times and tight code. Unfortunately, the product hasn't been seriously
  293. upgraded in quite a while and can't stand too much comparison. It's horribly
  294. non-ANSI compliant, has a weaker set of library functions than Micro-C,
  295. features non-standard file formats, and is generally incompatible with most
  296. published C code
  297.  
  298. If price is your concern, Mix Power C costs less to buy than PCC does to
  299. register and offers better performance along with the ANSI compliance that
  300. PCC lacks.  If you plan on using an unregistered copy, Gnu C/C++ is vastly
  301. superior and is legally free. If you're attracted to its tight, fast code and
  302. can live with quirks and without ANSI compliance, go with Dunfield Micro-C.
  303.